{include file="public/header" /}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.css"}
{load href="__PLUGINS__bootstrap/bootstrap-table.min.js"}
<style>
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0px;
        margin-top: 0px
    }

    #title span {
        float: right;
        margin-left: 3.333px;
    }

    .search {
        margin-bottom: 0px !important;
    }

    .asdlkjasd {
        background: #1ab394;
        color: #fff
    }

</style>
 <body class="gray-bg">
 <div class="wrapper wrapper-content {:config('adminClass.main')}">
    <div class="ibox float-e-margins">
        {include file="public/tophead"}
        {include file="public/top" /}
        <div class="ibox-content">
        {include file="public/topsection"}
            <div class="row row-lg">
                <div class="col-sm-12">
                    <div class="fixed-table-toolbar">
                        <form  method="get" action="">
                            <div class="pull-left search">
                                <div class="columns columns-right btn-group pull-left" >
                                    <select class="form-control" name="search_typeid">
                                        <option value="user_id" {eq name="search" value="user_id"}selected{/eq}>用户ID</option>
                                    </select>
                                </div>
                                <div class="columns columns-right btn-group pull-left" >
                                </div>
                                {php}
                                if(input('?param.search_typeid') || input('?param.search_name')){
                                {/php}
                                <div class="pull-right search">
                                    <a class="btn btn-w-m btn-link" href="{:url('welfare')}">返回管理</a>
                                </div>{php}
                                }
                                {/php}
                                <div class="pull-right search">
                                    <button style="border-radius:0px; border:1px solid #e5e6e7; border-left:0px" class="btn btn-default btn-outline" type="submit">搜索</button>
                                </div>
                                <div class="pull-right search">
                                    <input class="form-control input-outline" id="filter" type="text"
{php}
if(input('?param.search_name')){
            if(input('param.search_name')){
               echo "value='".input('search_name')."'";
            } 
        }
{/php}
                                     name="search_name" placeholder="搜索">
                                </div>
                            </div>
                        </form>
                    </div>
                    <div class="example">
                        <form class="form-horizontal" method="post">
                        <table data-toggle="table">
                            <thead>
                                <tr>
                                    <th data-align="center">ID</th>
                                    <th data-align="center">领取人</th>
                                    <th data-align="center">头像</th>
                                    <th data-align="center">性别</th>
                                    <th data-align="center">领取人id</th>
                                    <th data-align="center">金额</th>
                                    <th data-align="center">邀请时间</th>
                                    <th data-align="center">领取时间</th>
                                    <th data-align="center">操作</th>
                                </tr>
                            </thead> 
                            <tbody id="form">
                                {volist name="data" id="v"}
                                <tr id="id{$v.id}" class="class">
                                    <td id="id">{$v.id}</td>

                                    <td >
                                        {$v.user.name}
                                    </td>
                                    <td>
                                        <a href="{:strpos($v.user.head_portrait, 'http')===false?'__ROOT__':''}{$v.user.head_portrait}" title="{$v.user.name}" target="_blank">
                                            <img style="width:40px;height:40px;" src="{:strpos($v.user.head_portrait, 'http')===false?'__ROOT__':''}{$v.user.head_portrait}"/>
                                        </a>
                                    </td>
                                    <td >
                                        {$v.user.sex}
                                    </td>
                                    <td >
                                        {$v.user.id}
                                    </td>
                                    <td >
                                        {$v.reward}
                                    </td>
                                    <td> 
                                        <span {php}if(date('Y-m-d')==date('Y-m-d', $v['create_time']))echo 'style="color: #ed5565"';{/php}>
                                            {:date('Y-m-d H:i', $v.create_time)}
                                        </span>
                                    </td>
                                    <td> 
                                        <span {php}if(date('Y-m-d')==date('Y-m-d', $v['reward_get_time']))echo 'style="color: #ed5565"';{/php}>
                                            {if condition="$v.reward_get_time"}{:date('Y-m-d H:i', $v.reward_get_time)}{/if}
                                        </span>
                                    </td>
                                    <td> 
                                        {eq name="$v.reward_get" value="0"}
                                        <div class="btn btn-xs btn-primary" onclick="setStatus('{$v.id}')">取消奖励</div>
                                        {/eq}
                                    </td>
                                </tr>
                                {/volist}
                            </tbody>                          

                        </table>
                        </form>
                    </div>
                </div>  
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script type="text/javascript">
function member(id)
{
    layui.use('layer', function(){
        var layer = layui.layer;
        layer.open({
            title :'预览',
            area: ['100%', '100%'],
            type: 2,
            content: '{:url("member/index")}?search=id&name='+id
        });
    });
}
  function setStatus(id){
    ajaxFun("post","{:url('unwelfare')}",{id},'json',function(ret){
        if(ret){
            if(ret.ret){
                swal_msg(ret.ret,'','success',1)
            }else{
                layer.msg(ret.err)
            }
        }else{
            swal_msg("错误",ret,"error");
        }
        layer.close(index); 
    })
  }
</script>
 